package calvin.study.rabbitmq.mq;

import java.util.Date;

import org.springframework.amqp.rabbit.connection.CorrelationData;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import com.alibaba.druid.sql.visitor.functions.DateAdd;

import calvin.study.rabbitmq.model.order.Order;
import cn.hutool.core.date.DateUtil;

@Component
public class OrderSender {
	
	@Autowired
	private RabbitTemplate rabbitTemplate;
	
	public void send(Order order) {
		  CorrelationData correlationData = new CorrelationData();
	      correlationData.setId(order.getOrderId());
	      rabbitTemplate.convertAndSend("order_exchange","order.abcd",order,correlationData);
	}
	
	public static void main(String[] args) {
		System.out.println(DateUtil.offsetMinute(new Date(), 1));
	}

}
